package com.book.controller;

import com.book.service.ShoppingCarService;
import com.book.util.BaseResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 购物车表 前端控制器
 * </p>
 *
 * @author auto
 * @since 2025-04-02 06:38:55
 */
@RestController
@RequestMapping("/car")
@Tag(name = "购物车表", description = "购物车表相关接口")
public class ShoppingCarController {

    @Autowired
    private ShoppingCarService shoppingCarService;

    @ApiOperation(value = "查询用户的购物车")
    @GetMapping("/list/{userId}")
    public BaseResult<?> getShoppingCarListByUserId(@PathVariable("userId") String userId) {
        return BaseResult.successResult(shoppingCarService.getShoppingCarListByUserId(userId));
    }

}
